package online.shenme.day13;

import java.util.ArrayList;
import java.util.Random;

public class Identifing {
    public static void main(String[] args) {
        ArrayList list=new ArrayList();
        while (list.size()!=10) {
            if (list.contains(CheckCode())==false){
                list.add(CheckCode());
            }
        }

        for (Object o : list) {
            System.out.println(o);
        }
    }

    public static String CheckCode() {
        char[] chars=new char[26+26+10];
        initDate(chars) ;
        StringBuilder arr=new StringBuilder();
        Random random=new Random();
        for (int i = 0; i < 5; i++) {
            int index=random.nextInt(chars.length);
            arr.append(chars[index]);
        }
        return arr.toString();
    }

    public static void initDate(char[] chars) {
     int index=0;
        for (char i = 'a'; i <='z' ; i++) {
            chars[index]=i;
            index++;
        }
        for (char i = 'A'; i <='Z' ; i++) {
            chars[index]=i;
            index++;
        }
        for (char i = '0'; i <= '9'; i++) {
            chars[index]=i;
            index++;
        }
    }


}
